//
//  LGTagTableViewCell.m
//  LuxuryGoods
//
//  Created by 纳里健康 on 2018/5/28.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "LGTagTableViewCell.h"

@interface LGTagTableViewCell()<KMTagListViewDelegate>

@end

@implementation LGTagTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setTagCellWithDict:(NSDictionary *)dict
{
    /*
     @{
     @"title":@"历史记录",
     @"canDelete":@(YES),
     @"tagArray":_historyArray
     };
     */
    
    self.titleLabel.text = dict[@"title"];
    
    self.deleteBtn.hidden = ![dict[@"canDelete"] boolValue];
    
    self.tagView.frame = CGRectMake(self.tagView.x, self.tagView.y, SCREEN_WIDTH - 70, 0);
    self.tagView.delegate_ = self;
    [self.tagView setupSubViewsWithTitles:dict[@"tagArray"]];
    
    CGRect rect = self.tagView.frame;
    rect.size.height = self.tagView.contentSize.height;
    self.tagView.frame = rect;
    
    self.cellHeight = rect.size.height + 61;
}


- (void)ptl_TagListView:(KMTagListView*)tagListView didSelectTagViewAtIndex:(NSInteger)index selectContent:(NSString *)content
{
    if([self.delegate respondsToSelector:@selector(clickTagText:)])
    {
        [self.delegate clickTagText:content];
    }
    
    NSLog(@"index == %ld,content == %@",(long)index,content);
}

- (IBAction)deleteHistoryAction:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickDeleteBtn)]) {
        [self.delegate clickDeleteBtn];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
